<template>
<div>
  <el-container>
    <el-header>
        <el-menu
        :default-active="activeIndex"
        class="el-menu-demo"
        mode="horizontal"
        @select="handleSelect"
        background-color="#545c64"
        text-color="#fff"
        active-text-color="#ffd04b">
            <el-menu-item index="/index">主页</el-menu-item>
            <el-menu-item index="/users">用户管理</el-menu-item>
            <el-menu-item index="/file">文件管理</el-menu-item>
        </el-menu>    
    </el-header>
    <el-main>
        <router-view/>
    </el-main>
  </el-container>
</div>
</template>

<script>
export default {
  name:'Index',
    data() {
      return {
        activeIndex: this.$route.path
      };
  },
  methods: {
    handleSelect(key, keyPath) {
      this.$router.push(key);
    }
  },
  created() {
    console.log(this.$route.path);
  }
}
</script>